package com.retirement.audit.controller;

import com.retirement.audit.domain.OldAudit;
import com.retirement.audit.dto.OldAuditDto;
import com.retirement.audit.service.IOldAuditService;
import com.retirement.common.core.controller.BaseController;
import com.retirement.common.core.domain.AjaxResult;
import com.retirement.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lijy
 * @since 2023-12-25
 */
@Api(value = "审核管理", tags = "审核管理")
@RequiredArgsConstructor
@RestController
@RequestMapping("/audit")
public class OldAuditController extends BaseController {

    private final IOldAuditService iOldAuditService;

    @GetMapping("/page")
    @ApiOperation(value = "分页获取审核信息")
    public TableDataInfo listAudit(OldAuditDto dto){
        startPage();
        return getDataTable(iOldAuditService.listAudit(dto));
    }

    @PutMapping
    @ApiOperation(value = "修改审核信息")
    public AjaxResult updateAudit(@RequestBody OldAudit dto) throws IllegalAccessException {
        return AjaxResult.success(iOldAuditService.updateAudit(dto));
    }

    @DeleteMapping("/{id}")
    @ApiModelProperty(value = "删除审核信息")
    public AjaxResult deleteAudit(@PathVariable("id") String id){
        return AjaxResult.success(iOldAuditService.removeById(id));
    }

}
